package Args

import (
	"os"
	"strings"
)

func GetArgs(prefix, defaultValue string) string {
	return getArgs(os.Args, prefix, defaultValue)
}

func getArgs(args []string, prefix, defaultValue string) string {
	for _, arg := range args {
		if !strings.HasPrefix(arg, prefix) {
			continue
		}

		return arg[len(prefix):]
	}

	return defaultValue
}

func HasArg(prefix string) bool {
	for _, arg := range os.Args {
		if arg != prefix {
			continue
		}

		return true
	}

	return false
}
